<?php

namespace app\admin\controller\service\money;

use app\common\controller\Backend;
use think\Db;
/**
 * 会员余额变动管理
 *
 * @icon fa fa-circle-o
 */
class Usermoneylog extends Backend
{

    /**
     * Usermoneylog模型对象
     * @var \app\admin\model\service\money\Usermoneylog
     */
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\admin\model\service\money\Usermoneylog;

    }

    public function deduct()
    {
        $get = input('get.','');
        $money = \app\admin\model\User::where('id',$get['user_id'])->value('money');
        if($this->request->isPost())
        {
            $params = input('post.');
            \app\api\model\service\User::money($params['money'],$params['user_id'],$params['memo']);
            echo "<script>window.parent.location.reload()</script>";
        }
        $this->view->assign(["user_id"=>$get['user_id'],'userMoney'=>$money]);
        return $this->view->fetch();
    }




}
